package com.zy.pool;

import com.zy.pool.pool.IConnectionPool;

import java.sql.Connection;

/**
 * @author Angle
 * @package: com.zy.pool
 * @describe: 模拟线程启动，去获得连接
 * @date: 2018/02/06
 **/
public class ThreadConnection implements Runnable{

    private IConnectionPool pool;

    @Override
    public void run() {

    }

    public Connection getConnection(){
        Connection conn=null;
        if(pool!=null&&pool.isActive()){
            conn=pool.getConnection();
        }
        return conn;
    }

    public Connection getCurrentConnection(){
        Connection conn = null;
        if(pool != null && pool.isActive()){
            conn = pool.getCurrentConnection();
        }
        return conn;
    }
}
